#include<iostream>
using namespace std;
#include<vector>
#include<unordered_map>
class Solution {
public:
    int winningPlayerCount(int n, vector<vector<int>>& pick) {
        vector<int> vec(n);
        int ans = 0;
        unordered_map<int, unordered_map<int, int>> s;
        for (auto& e : pick) {
            ++s[e[0]][e[1]];
            if (s[e[0]][e[1]] > e[0])
                vec[e[0]] = 1;
        }
        for (int i = 0; i < n; ++i)
            ans += vec[i];
        return ans;
    }
};